/*
 * CSMSManager.h
 *
 *  Created on: Dec 21, 2011
 *      Author: ToanNhan
 */

#ifndef CSMSMANAGER_H_
#define CSMSMANAGER_H_

#include <es_sock.h>
#include <e32base.h>
#include <gsmubuf.h>
#include <Gsmumsg.h>

#include "SMShandler.h"
#include "smut.h"
#include "SMSCLNT.H"
#include "SMUTSET.H"

#include <rsendas.h>
#include <rsendasmessage.h>
#include "GpsPositionRequest.h"
class FSs;

class CSMSManager : public CActive, public MMsvSessionObserver
	{	
	//private variant
private:
	CSmsMessage* iSmsMessage;
	RSocketServ iSocketServer;
	RSocket iSocket;
	RFs iFs;
	TBool iRead;
	TPckgBuf<TUint> iPckgBuf;
	TBuf<255> iBuf;
	CGpsPositionRequest *gpsRequest;
	CSmsHandler *smsHandler;
public:
	// constructor	
	static CSMSManager* NewL();
	static CSMSManager* NewLC();
	virtual ~CSMSManager();
private:
	CSMSManager();
	void ConstructL();
	
	
	// private method
	void RunL();
	void DoCancel();
    void HandlerMessage();

	// public method
public:
	void SocketListener();
	TBool SendSMSL(TDesC& toNumber, TDesC& content);
	void GetMessageCenterL(TDes& aMsgCenter);
	void HandleSessionEventL( TMsvSessionEvent aEvent, TAny* aArg1,
	                                  TAny* aArg2, TAny* aArg3 );
	};

#endif /* CSMSMANAGER_H_ */
